<?php


require 'conf.inc.php'; 


function print_item ($prod,$cat) {
  
  global $products;
  $item = '';
 
  $item .= '<li style="height: 100px"><img style="max-height:100px; max-width: 100px; width:80px; height: 100px; padding: 10px;white-space:normal;" 
          src="' . $prod['image_src'] . '"/><p></p></li>';
  
  $item .= '<li><h1 style="white-space:normal;">' . $prod['short_description'] . '</h1> </li>';
 $item .= '<li><h3 style="white-space:normal;">' . $prod['description'] . '</h3> </li>';
  
  $item .= '<li><h3>' . 'Recensioni e feedback degli utenti' . '</h3> </li>';
  
  $item .= '<li><button style="margin-bottom:30px" id="products['.$cat.'][' . $prod['id'] . ']" name="addProductDetails" type="submit" data-theme="d">Aggiungi</button></li>';
  
  //$item .= '<a href="#" data-role="button"><h5>Aggiungi allo shake</h5></a>';
  
  
  
  return $item;
  
}




$product_code = (isset($_POST['product_code'])) ? $_POST['product_code'] : '';


foreach ($products as $category => $categoryProducts) {
	foreach($categoryProducts as $product)
		if ($product['id'] == $product_code)
		   echo print_item($product,$category);

}




?>